package com.splic.api.controller.product;

import com.splic.common.core.domain.ResponseObj;
import com.splic.system.service.ISysConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 系统配置
 *
 * @author ruoyi
 */
@RestController
@RequestMapping("/api/config")
@Slf4j
public class ApiSysConfigController {

    @Autowired
    private ISysConfigService configService;

    @GetMapping("/getConfig")
    public ResponseObj<String> getConfig(String configKey) {
        try {
            String value = configService.selectConfigByKey(configKey);
            return ResponseObj.SUCCESS(value);
        } catch (Exception e) {
            log.error("获取失败",e);
            return ResponseObj.ERROR("获取失败");
        }
    }
}
